<template>
  <div>
    <div class="h60">
      <span class="exe_title">{{ Num }}.{{ item.title }}</span>
      <span class="tags">
        <el-tag class="jj-bg" v-if="item.isJt == 1">机经</el-tag>
        <el-tag class="yc">预测</el-tag>
        <el-tag class="ttNum">{{ item.titleNumber }}</el-tag>
      </span>
    </div>
    <!-- 阅读型的MCS -->
    <div class="content" v-if="item.content != ''">{{ item.content }}</div>
    <!-- 听力型的MCS -->
    <div class="content" v-if="item.url">
      <Audioplayer :url="item.url"></Audioplayer>
    </div>
    <h1 v-if="item.url == ''" class="none_audio_tip">此题暂未上传录音</h1>
    <div class="descb">{{ item.describe }}</div>

    <div class="radio">
      <el-form>
        <el-radio-group v-model="checkedRadio">
          <el-radio
            size="medium"
            v-for="(item, index) in radio"
            :key="index"
            :label="index + 1"
            @change="getRadioVal"
            >{{ item }}</el-radio
          >
        </el-radio-group>
      </el-form>
    </div>
    <div class="time">
      <span>答题时间：{{ s_to_hs(answerTime) }}</span>
    </div>
  </div>
</template>

<script>
import Audioplayer from '../../player'
import readingUtil from "@/utils/readingUtil";
export default {
  mixins: [readingUtil],
  props: ['item', 'Num'],
  components: {
    Audioplayer,
  },
  data () {
    return {
      radio: [],
      answerTime: 0,
      checkedRadio: '',
    }
  },
  created () {
    this.radio = this.item.option.split('&@#')
    setInterval(() => {
      this.answerTime++
    }, 1000);

    this.checkedRadio=this.item.answer-0  // 回显已提交的答案
  },
  methods: {
    getRadioVal (item) {
      this.$emit('sendAnswer', this.checkedRadio,'flag')
    }
  },

}
</script>


<style lang="less" scoped>
.none_audio_tip {
  font-size: 1.25rem;
  color: #999;
  padding: 1.125rem;
}
.time {
  font-size: 1rem;
  font-family: Microsoft YaHei;
  font-weight: 400;
  color: #333333;
  position: relative;
  margin-top: 1.875rem;
  span {
    margin-right: 1.875rem;
  }
  .iconfont {
    font-size: 1.5rem;
    color: #ccc;
  }
  .end {
    position: absolute;
    right: -1.5rem;
    text-align: right;
  }
}
.descb {
  padding-left: 1.125rem;
  font-size: 1.2rem;
  font-weight: bold;
  color: #333;
}
// 单选
.radio {
  .el-radio {
    margin-left: 1.125rem;
    white-space: pre-wrap;
    line-height: 2.1875rem;
    width: 54rem;
  }
  /deep/.el-radio__input.is-checked .el-radio__inner {
    background-color: #ff5e4e;
    border-color: #ff5e4e;
  }
  /deep/.el-radio__input.is-checked + .el-radio__label {
    color: #666;
    width: 70rem;
  }
  /deep/.el-radio__label {
    font-size: 1.125rem;
  }
  /deep/.el-radio-group {
    width: 70rem;
  }
}
.h60 {
  height: 3.75rem;
  line-height: 3.75rem;
  background-color: #f7f7f7;
  margin-top: 1.875rem;
  margin-bottom: 1rem;
  display: flex;
  .label {
    height: 100%;
  }
  .tags {
    width: 36.625rem;
  }
  .exe_title {
    width: 90rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #333;
    font-size: 1rem;
    padding-left: 1.25rem;
  }
  .el-tag {
    height: 1.575rem;
    line-height: 1.575rem;
    margin-right: 0.9375rem;
    color: #fff;
    padding: 0 0.375rem;
    border: none;
  }

  .ttNum {
    background-color: #94d0f7;
  }
  .jj-bg {
    background: #ff9b4f;
  }
  .yc {
    background-color: #00cccc;
  }
}

.content {
  font-size: 1.125rem;
  color: #333;
  padding: 1.25rem;
  background-color: #fffafa;

  border: 1px dashed #ff5e4e;
  margin-bottom: 1rem;
}
.title {
  font-size: 1.5rem;
  font-family: Microsoft YaHei;
  font-weight: 400;
  color: #333333;
  margin-top: 1rem;
  padding: 0 1.875rem;
}
.el-form {
  // padding: 0 1.875rem;
  margin-top: 1.25rem;
  font-size: 1.125rem;
}
</style>